✨ BCA JUL24 Batch ✨

Join Our WhatsApp Group

Anukasif Pic

5.4 - File Handling - MCQs

Interactive MCQs Quiz

Test your knowledge with these questions

1. Which function is used to open a file in C?

2. What is the return type of fopen() function?

3. Which mode in fopen() is used to open a file for writing at the end of the file?

4. Which function is used to read a single character from a file?

5. What does the fclose() function do in C?

6. What is the correct syntax for closing a file in C?

7. What is the function used to get the current position of the file pointer?

8. Which function is used to write formatted data into a file?

9. What happens if a file opened in "r" mode does not exist?

10. Which function is used to set the position of the file pointer in C?

11. How do you write an integer into a file?

12. Which function is used to read a string from a file in C?

13. What is the file pointer variable type in C?

14. What does the rewind() function do in file handling?

15. What is the default mode when a file is opened using fopen()?

16. What is the purpose of the ftell() function in C?

17. Which function is used to write a character to a file?

18. How do you read an integer from a file?

19. What does the function fseek() do in file handling?

20. What is the result of opening a file in "w" mode if the file already exists?

21. Which function is used to open a file in C?

22. What does the 'r' mode in fopen() signify?

23. Which function is used to write data to a file in C?

24. What does the fclose() function do in C?

25. Which of the following modes does not create a new file if it doesn’t exist?

26. Which function reads a single character from a file?

27. Which function writes a string to a file in C?

28. What is the return type of the fopen() function?

29. Which function is used to set the position to a specified location in a file?

30. Which function is used to get the current position in a file?

31. What does the 'a' mode in fopen() signify?

32. Which function can be used to read formatted data from a file?

33. What is the correct way to close a file in C?

34. Which function can be used to write formatted data into a file?

35. In C, what is a file pointer?

36. Which of the following is not a valid file operation mode?

37. Which function is used to write integer data into a file?

38. How do you check if fopen() failed to open a file?

39. Which function reads a string from a file?

40. What will fopen() return if it fails to open a file?

41. Which function is used to open a text or binary file in C?

42. Which mode is used to open a binary file for reading?

43. What is the extension used for text files?

44. Which of the following is used to open a file in binary mode?

45. What does the fwrite() function do in C?

46. Which function is used to read from a binary file in C?

47. How is data stored in a binary file?

48. What is the primary difference between text files and binary files?

49. Which of the following modes can be used to append data to a binary file?

50. What is the return value of fread() on successful reading?

51. Which function can write data into a binary file?

52. What happens if you try to open a binary file in "rb" mode and the file does not exist?

53. Which function is used to move the file pointer to a specific position in a file?

54. What is the advantage of using binary files over text files?

55. Which mode is used to open a binary file for both reading and writing?

56. How is end-of-file detected when working with text files?

57. In which of the following is data stored in human-readable format?

58. What does fseek() return if it successfully moves the file pointer?

59. What happens when fwrite() fails to write to a file?

60. Which of the following file modes is used to overwrite an existing text file?